<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<jsp:include page="/WEB-INF/views/layouts/head.jsp"></jsp:include>
<html>
<head>
<link rel="stylesheet" href="${ctxStatic }/index/css/daycars.css" />
<link href="${ctxStatic }/index/css/header.css" rel="stylesheet">
<script src="${ctxStatic}/jquery/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
	var suitrtnprice = 0;
	if("${tRentproduct.suitrtnprice}".legth!=0){
		suitrtnprice = "${tRentproduct.suitrtnprice}";
	}
	var totalprice = 0.00;
	$(function(){
		var keyVal2 = "${sessionScope.mes}";
		if(keyVal2.length!=0){  
			alert(keyVal2);
			window.history.go(-1);  
		}
		$("#bookingForm").validate({
			rules: {
				boardaddr: "required",
				contacts: {
					required: true,
				},
				payertel:{
					required:true,
					isMobile : true
				}
			},
			messages: {
				boardaddr: "",
				contacts: {
					required: "",
				},
				payertel: {
					required: ""
				}
			}
		});
	        jQuery.validator.addMethod("isMobile", function(value, element) {
	            var length = value.length;
	            var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
	            return this.optional(element) || (length == 11 && mobile.test(value));
	        }, "");
		$('#purchasenum').on('change',function(){
			var integer = /^[0-9]*[1-9][0-9]*$/;
			var val = $(this).val();
			if(val!='' && !integer.test(val)) {
				$(this).focus();
			} else {
				totalprice = accMul(val,suitrtnprice);
				$("#totalPrice").val(totalprice);
				$('#suitrtnprice').text("￥"+totalprice.toFixed(2));
			}
		});
		$('#purchasenum').trigger('change');
	}); 
	function accMul(arg1, arg2) {//arg1车辆数,arg2价格
				return arg1*arg2;
	}
	function submitForm() {//arg1车辆数,arg2价格
		var $time = $("#fromdateStr").val()+" "+$("#time").val();
		$.post("${ctxFront}/sms/checkTime","time="+$time,function(d){
			if(d==1){//"距离发车时间不足2小时，请重新选择发车时间"
				alert("距离发车时间不足2小时，请重新选择出发时间");
				return false;
			}else{
				$("#bookingForm").submit();
			}
		});
	}
	function selectDatediff(obj) {
		var $value=obj;
		$.post("${ctxFront }/rentproduct/getPrice",{"fromdateStr":$value,"rentid":"${tRentproduct.rentid }"},function(d){
			suitrtnprice = d;
			var val = $("#purchasenum").val();
			totalprice = accMul(val,suitrtnprice);
			$('#suitrtnprice').text("￥"+totalprice.toFixed(2));
			$("#totalPrice").val(totalprice);
		});
	}
</script>
<script type="text/javascript" src="${ctxStatic }/index/js/map.js"></script>
</head>
<%
session.removeAttribute("mes");
	%>
<body><input type="hidden" id="menuInfo" value="indexTravelRent">
    <form id="bookingForm" action="${ctxFront}/rentproduct/travelbooking" method="post" >	
    <input type="hidden" name="ordername" value="${rentgroup.productname }" />
	<input type="hidden" name="ordertype" value="${query.rentType }" />
	<input type="hidden" name="bookingdays" value="${query.daysnum }" />
	<input type="hidden" name="realscheid" value="${query.rentid }" />
	<input type="hidden" name="totalPrice" value="" id="totalPrice" />
	<input type="hidden" name="office.id" value="${tRentproduct.office.id }" id="officeid" />
	<input type="hidden" name="cargotypeid" value="${tRentproduct.cargotype.cargotypeid }" id="cargotypeid" />
	<input type="hidden" name="office.name" value="${rentgroup.office.name }" />
	<input type="hidden" name="office.iswifi" value="${param.iswifi }" />
	<input type="hidden" name="office.powersupply" value="${param.powersupply }" />
	<input type="hidden" name="office.tablewater" value="${param.tablewater }" />
	<input type="hidden" name="office.businesssuit" value="${param.businesssuit }" />
	<input type="hidden" name="office.paper" value="${param.paper }" />
		<div class="details_warp">
			<div class="details_main">
				  <div class="de_page clearfix">
				  	   <div class="depage_left">
				  	   	   <div class="dp_information">
				  	   	   	      <div class="dp_info_title">
				  	   	   	      	  <h5>详情信息</h5>
				  	   	   	      </div>
				  	   	   	      <div class="product_i clearfix" style="width: 750px">
				  	   	   	      	  <div class="pro_l" style="float: left">
				  	   	   	      	  	   <div class="pro_prc">
				  	   	   	      	  	   	   <img src="${param.images}" />
				  	   	   	      	  	   </div>
				  	   	   	      	  	   <p class="prc_txt">${tRentproduct.cargotype.typename }</p>
				  	   	   	      	  </div>
				  	   	   	      	  <div class="product_explan">
				  	   	   	      	  	    <ul class="pro_list">
 <li class="pro_si"><span class="prosi_tit">产品名称：</span>
 <span class="prosi_txt"><a href="javascript:void(0)" title="${rentgroup.productname }">
 <c:if test="${fn:length(rentgroup.productname) > 20 }">
	${fn:substring(rentgroup.productname,0,20)}...
</c:if>
<c:if test="${fn:length(rentgroup.productname)  <= 20 }">
	${rentgroup.productname }
</c:if>
 <%-- ${fn:substring(rentgroup.productname,0,30) }... --%>
 </a>
 </span></li>
 <%-- <li class="pro_si"><span class="prosi_tit">用车时间：</span><span class="prosi_txt">${query.fromdateStr}</span></li> --%>
 <li class="pro_si"><span class="prosi_tit">包车天数：</span><span class="prosi_txt">${query.daysnum }天</span></li>
 <li class="pro_si"><span class="prosi_tit">服务车队：</span><span class="prosi_txt">${rentgroup.office.abbr }</span></li>
 <li class="pro_si"><span class="prosi_tit">特色服务：</span>
 <span class="prosi_txt">
	<c:if test="${param.iswifi == '1' }">无线wifi</c:if>
	<c:if test="${param.powersupply == '1' }">车载充电</c:if>
	<c:if test="${param.tablewater == '1' }">免费饮用水</c:if>
	<c:if test="${param.businesssuit == '1' }">商务正装</c:if>
	<c:if test="${param.paper == '1' }">免费纸巾</c:if>		
</span></li>
				  	   	   	      	  	    </ul>
				  	   	   	      	  </div>
				  	   	   	      </div>
				  	   	   </div>
				  	   	   <div class="depage_main">
				  	   	   	    <div class="depage_box">
				  	   	   	    	  <ul class="depage_in_list">
<li class="dp_ils"><label for="车辆数">车辆数：</label>
<input id="purchasenum" type="number" name="purchasenum" placeholder="请填写用车辆数" min="1" value='1'/></li>
<li class="dp_ils"><label for="上车地点">上车地点：</label>
<input type="text" placeholder="第一天上车地点" id="suggestId" name="boardaddr"/>
<div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div></li>
<li class="dp_ils"><label for="出发日期">出发日期：</label>
<input id="fromdateStr" name="fromdateStr" type="text" readonly="readonly" maxlength="20" class="container_type_sn Wdate"
style="width: 120px" value="${tomorrow }" 
onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'${today}',maxDate:'${maxDay }',
onpicking:function(dq){selectDatediff(dq.cal.getNewDateStr());},isShowClear:false});"/>&nbsp;
<input id="time" name="time" type="text" readonly="readonly" maxlength="20" class="container_type_ss Wdate" value="${time }"
style="width: 103px" onclick="WdatePicker({dateFmt:'HH:mm',isShowClear:false});"/>
<p style="border-bottom: 1px dashed #C0C0C0;margin: 20px 0;"></p>
<li class="dp_ils"><label for="联系人姓名">联系人：</label>
<input type="text" placeholder="联系人姓名" name="contacts" value="${orders.contacts }"/></li>
<li class="dp_ils"><label for="联系电话">联系电话：</label>
<input type="text" placeholder="输入手机号" name="payertel" value="${sessionScope.front_user.mobile}" /></li>
				  	   	   	    	  </ul> 	    	  
				  	   	   	    </div>
				  	   	        <div class="de_notice">
				  	   	        	 <p>重要提示：</p>
				  	   	        	 <p>1.如您的预订时间距离发车时间在12小时以内，为保证您的顺利出行，请保持您的电话畅通。</br>
2.司机食宿费一般由订车人安排，如不能安排，由司机向订车人收取相应的食宿补贴，标准为：住宿200元/晚、三餐80元/天。<br>
3.为了保证您的用车安全及良好体验，建议您每日用车时间不超过12小时。否则您需要向司机支付超时服务费。标准：<font color='red'>"${tRentproduct.cargotype.typename }：
${tRentproduct.outtimefee }元/小时"</font></br>
4.如产生不含费用项请在服务结束后，将钱面付司机。严禁司机额外乱收费，如发现可联系霞客约车客服核实退还。</br>
5. 开具发票:如需发票，由霞客约车根据订单金额统一开具。请在服务完成后至我的账户—关于发票—立即开票填写开票信息，开票总金额为订单费用。</p>
				  	   	        </div>
				  	   	   </div>
				  	   </div>
				       <div class="depage_right">
				       	    <div class="depage_cost">
				       	    	  <i class="cost_icon"></i>
				       	    	  <h5>费用明细：</h5>
				       	    	  <p style="text-align: justify;">
				       	    	  	   费用包含：【一价全包】全程司机代驾服务费、车辆使用费、车辆油电费、 空驶费、夜间服务费、司机小费、路桥费、 停车费、摆渡费。
</br>费用不含：超时服务费（建议行车时间不超过12小时）、司机食宿费。
				       	    	  </p>
				       	    	  <p class="cost_ing">
				       	    	  	     <span>价格：</span>
				       	    	  	     <span id="suitrtnprice">
<c:set var="totalPrice" value="${tRentproduct.suitrtnprice }"/>${totalPrice}   	    	  	     
				       	    </span>
				       	    	<button class="reserve" id="subBtn"  onClick="submitForm();return false;">预定</button>
				       	    	  </p>
				       	    </div>
				       	    <div class="depage_cancel">
				       	    	     <i class="cancel_icon"></i>
				       	    	     <h5>取消须知：</h5>
				       	    	     <p>
				       	    	     	●该产品支持取消。<br>
●出行日期前72小时前取消，免收违约金；<br>
●出行日期前72小时至24小时取消，收取费用总额${sessionScope.front_user.office.flatType ne '2' or noticeType eq ORDER_TYPE_RENTPRODUCT_CUSTOM?'30%':'10%' }的违约金；<br>
●出行开始前24小时取消，收取费用总额50%的违约金；<br>
●超过发车时间不可退款。<br>
●如需改期，请申请取消后重新预订。<br>
				       	    	   </p>
				       	    </div>
				       </div>
				  </div>
			</div>
		</div>
		</form>
</body>
<jsp:include page="/WEB-INF/views/layouts/foot.jsp"></jsp:include>
</html>